<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/my_reverse.css">
    <script src="https://at.alicdn.com/t/font_2891532_1tfbb9l2y1y.js"></script>
</head>

<body>
    <div class="wrap">
        <div class="box">
            <button id="back">
                <svg class="icon" aria-hidden="true">
                    <use xlink:href="#icon-fanhui2"></use>
                </svg>
            </button>
            <h4>我的预约</h4>
            <div class="info">
                <p id="name"></p>
                <p id="date"></p>
                <p id="time"></p>
            </div>
            <div class="QR_code">
                <img id="QR" src="" alt="">
            </div>
        </div>
    </div>

    <script src="封装获取cookie.js"></script>
    <script>
        let name = document.querySelector("#name");
        let time = document.querySelector("#time");
        let QR = document.querySelector("#QR")


        let localName = localStorage.getItem("name");
        let localDate = localStorage.getItem("day_time").split("-");
        let localTime = localStorage.getItem("time");

        let img = localStorage.getItem("QR_Img");
        console.log(img);

        if (localName && localTime && localDate) {
            name.innerHTML = "姓名：" + localName;
            date.innerHTML = `日期：${localDate[0]}年${localDate[1]}月${localDate[2]}日`;
            time.innerHTML = "场次：" + localTime;
            QR.src = img;
        } else {
            name.innerHTML = "没有记录";
        };

        // 返回上一页
        back.addEventListener("click", () => {
            location.assign("./index.html");
        });
    </script>
</body>

</html>